package com.company.restaurant.dto;

import java.io.Serializable;

/**
 * Description of class.
 * Created 3/26/14 5:04 PM
 *
 * @author andrey.rodin@playtech.com
 */

public final class MessageWrapper<M extends Serializable> implements Serializable {

    private static final long serialVersionUID = -1533546239947607488L;
    private final int code;
    private final int protocol;
    private final M message;

    public MessageWrapper(int code, int protocol, M message) {
        this.code = code;
        this.protocol = protocol;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public int getProtocol() {
        return protocol;
    }

    public M getMessage() {
        return message;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder();
        sb.append("MessageWrapper");
        sb.append("{code=").append(code);
        sb.append(", protocol=").append(protocol);
        sb.append(", message=").append(message);
        sb.append('}');
        return sb.toString();
    }
}
